/*
 * File Name: ShowExecutionWindowAction.java
 * Created on: 
 */

package co.edu.uniandes.intercon.client.action;

import java.util.Map;

import javax.swing.JFrame;

import co.edu.uniandes.intercon.client.gui.execute.ProcessApplicationExecutionWindow;
import co.edu.uniandes.intercon.core.model.ApplicationDto;

/**
 * Action used to show the execution window
 * 
 * @author Fabian Gutierrez [fagossa@gmail.com]
 */
public class ShowExecutionWindowAction extends AbstractBaseGUIAction {

	/*
	 * Dialog used to execute the process applications
	 */
	private ProcessApplicationExecutionWindow dialog;

	/**
	 * @see AbstractBaseGUIAction#execute(Map)
	 */
	public Object execute(Map<String, Object> params) {
		JFrame window = (JFrame) params.get("window");
		ApplicationDto applicationDto = (ApplicationDto) params.get("applicationDto");
		if (dialog == null) {
			dialog = new ProcessApplicationExecutionWindow(window);
			dialog.setModal(true);
		}
		dialog.initProcessApplication(applicationDto);
		dialog.setVisible(true);
		return null;
	}

}
